home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5754 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.2 KB  |  43 lines

  1. Path: esb.bbn.com!user
  2. From: rshapiro@bbn.com (R Shapiro)
  3. Newsgroups: comp.sys.mac.programmer.codewarrior,comp.lang.c++
  4. Subject: using a template parameter as a qualifier -- legal or not?
  5. Date: Tue, 06 Feb 1996 12:58:31 -0500
  6. Organization: BBN
  7. Message-ID: <rshapiro-0602961258310001@esb.bbn.com>
  8. NNTP-Posting-Host: esb.bbn.com
  9.  
  10. I'd like to use the formal argument to a template as the qualifier of a
  11. qualified typename within the template. This doesn't work in CodeWarrior
  12. 8, it does work in VC++ 4.0, and I can't tell from ARM whether or not it
  13. *should* work.
  14.  
  15. Here's a more specific example:
  16.  
  17. template <class OBJECT>
  18. class OrderedCollection {
  19.    typedef void (OBJECT::*memberMapper)(void);
  20. .
  21. .
  22. .
  23. };
  24.  
  25. I would like the typedef 'memberMapper' to refer to pointers to member
  26. functions (of no arguments and returning no value) of whatever class is
  27. specified in a given instantiation of the template.
  28.  
  29. For instance, if X and Y are classes, I would expect memberMapper in
  30. OrderedCollection<X> to be:
  31.  
  32.   void (X::*memberMapper)(void)
  33.  
  34.  
  35. and memberMapper in OrderedCollection<Y> to be:
  36.  
  37.    void (Y::*memberMapper)(void)
  38.  
  39. Should this work or not? If not, why not? If so -- this is a bug in CW8.
  40.  
  41. -- 
  42. rs/rshapiro@bbn.com
  43.